// 判断图片是否加载完成
export function imgLoad(pics){
    return new Promise((resolve,reject)=>{
        const picsAll = pics.map((imgurl) => {
            return new Promise((resolve, reject) => {
                const img = new Image();
                img.src = imgurl;
                img.onload = () => resolve(imgurl);
                img.onerror = () => reject(new Error(imgurl + ' load error'));
            })
        });
        Promise.all(picsAll).then(() => {
            resolve('success');
        }).catch((e) => {
            reject('error');
        })
    })
}